/**
 * @file   1027.cpp
 * @author Shuang Hu <hsmath@ubuntu>
 * @date   Mon May 24 00:18:26 2021
 * 
 * @brief  PAT 1027
 * 
 **/
#include<iostream>
#include<string>
#include<vector>
using namespace std;
void change(int t){
    vector<int> data;
    while(1){
	int d=t/13;
	if(d==0){
	    data.push_back(t);
	    break;
	}
	data.push_back(d);
	t=t-d*13;
    }
    int zeroes=2-data.size();
    for(int i=0;i<zeroes;i++){
	cout<<"0";
    }
    for(int i=0;i<data.size();i++){
	if(data[i]>=10){
	    char c='A'+data[i]-10;
	    cout<<c;
	}else{
	    cout<<data[i];
	}
    }
}
int main(){
    int color[3];
    for(int i=0;i<3;i++){
	cin>>color[i];
    }
    cout<<"#";
    for(int i=0;i<3;i++){
	change(color[i]);
    }
    cout<<endl;
}
